<?php
    $host='localhost';
    $username='root';
    $password='root';
    $dbname='database9';
    $link=mysqli_connect($host,$username,$password);
    if ($link=mysqli_connect($host,$username,$password)){
        echo "<meta charset=\"UTF-8\"> <script> type='text/javascript'>alert('数据库连接成功!!!');</script>";
    }else{
        echo "<meta charset=\"UTF-8\"> <script> type='text/javascript'>alert('数据库连接失败!!!');</script>";
    }
    if (mysqli_select_db($link,$dbname)){
        echo "<meta charset=\"UTF-8\"> <script> type='text/javascript'>alert('数据库选择成功!!!');</script>";
    }else{
        echo "<meta charset=\"UTF-8\"> <script> type='text/javascript'>alert('数据可选择失败!!!');</script>";
    }
